<template>
  <transition name="slide">
    <div class="modal" v-show="showModal">
      <div class="mask"></div>
      <div class="modal-dialog">
        <div class="modal-header">
          <span>{{title}}</span>
          <a href="javascript:;" class="icon-close" @click="$emit('cancel')"></a>
        </div>
        <div class="modal-body">
          <slot name="body"></slot>
        </div>
        <div class="modal-footer">
          <div class="btn-group">
            <a href="javascript:;" class="btn" v-if="btnType==='1' || btnType === '3'" @click="$emit('submit')">{{sureText}}</a>
            <a href="javascript:;" class="btn btn-default" v-if="btnType==='2' || btnType === '3'" @click="$emit('cancel')">{{cancelText}}</a>
          </div>
        </div>
      </div>
    </div>
  </transition>
</template>

<script>
  export default {
    name:'modal',
    props: {
      // 大框big 中框middle 小框small 表单form
      modalType: {
        type: String,
        default: 'form'
      },
      title: {
        type: String,
      },
      //按钮类型 1 确定 2 取消 3 确定和取消 
      btnType: {
        type: String,
      },
      sureText: {
        type: String,
        default: '确定'
      },
      cancelText: {
        type: String,
        default: '取消'
      },
      showModal: Boolean
    }
  }
</script>

<style lang='scss' scoped>
  @import '@/assets/scss/mixin.scss';
</style>
